<template>
    <div>{{ sum }}</div>
    <button @click="add">点我+1</button>
</template>
<script setup lang="ts">
import { onBeforeMount, onBeforeUpdate, onMounted, onUpdated, ref } from 'vue'
const sum = ref(0)
const add = () => {
    sum.value++;
}

// 创建前
console.log('创建')
onBeforeMount(() => {
    console.log('安装前')
})
onMounted(() => {
    console.log('安装完毕')
})

onBeforeUpdate(() => {
    console.log('更新前')
})

onUpdated(() => {
    console.log('更新完毕')
})

</script>